-
Notifications
You must be signed in to change notification settings - Fork 4
Add exportCoordinates function to Graph class
#214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| std::string line; | ||
| std::getline(ifs, line); | ||
| assert((void("Invalid file format."), line == "nodeId;lat;lon")); | ||
| double dLat, dLon; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule
| continue; | ||
| } | ||
| std::istringstream iss{line}; | ||
| std::string nodeId, lat, lon; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule
| std::getline(iss, nodeId, ';'); | ||
| std::getline(iss, lat, ';'); | ||
| std::getline(iss, lon, '\n'); | ||
| dLat = lat == "Nan" ? 0. : std::stod(lat); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule
| std::getline(iss, lat, ';'); | ||
| std::getline(iss, lon, '\n'); | ||
| dLat = lat == "Nan" ? 0. : std::stod(lat); | ||
| dLon = lon == "Nan" ? 0. : std::stod(lon); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule
| std::getline(iss, lon, '\n'); | ||
| dLat = lat == "Nan" ? 0. : std::stod(lat); | ||
| dLon = lon == "Nan" ? 0. : std::stod(lon); | ||
| if (m_nodes.contains(std::stoul(nodeId))) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule
| std::ofstream file{path}; | ||
| // Column names | ||
| file << "nodeId;lat;lon\n"; | ||
| for (const auto& [id, node] : m_nodes) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule
| file << "nodeId;lat;lon\n"; | ||
| for (const auto& [id, node] : m_nodes) { | ||
| file << id << ';'; | ||
| if (node->coords().has_value()) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule
| } else { | ||
| file << "Nan;Nan"; | ||
| } | ||
| file << '\n'; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 10.1 rule
| void exportMatrix(std::string path = "./matrix.dsm", bool isAdj = true); | ||
| /// @brief Export the nodes' coordinates to a file | ||
| /// @param path The path to the file to export the nodes' coordinates to (default: ./nodes.dsm) | ||
| void exportCoordinates(std::string const& path = "./coordinates.csv"); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.8 rule
| void exportMatrix(std::string path = "./matrix.dsm", bool isAdj = true); | ||
| /// @brief Export the nodes' coordinates to a file | ||
| /// @param path The path to the file to export the nodes' coordinates to (default: ./nodes.dsm) | ||
| void exportCoordinates(std::string const& path = "./coordinates.csv"); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 13.4 rule
No description provided.